<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="DaosImpl.RoomDaoImpl"  import="Beans.RoomType" import="Beans.Room"%>
<%@ page import="DaosImpl.ClientDaoImpl" %>
<html>
  <head>
	<meta charset="UTF-8">
    <title>实时房态</title>
    <link href="stylesheets/realTimeRoom.css" type="text/css" rel="stylesheet">
    <style>
        html,body{
            height: 100%;
            margin:0;
            padding: 0;
        }
    </style>
  </head>
  
  <body>
    <div id="themeText">酒店实时房态查看</div>
    <div id="showRoomFrame">
        <div>
            <p >酒店精选50间</p>
            <%
            	
            	RoomDaoImpl guestRoomDao = new RoomDaoImpl();
               	ArrayList roomList = new ArrayList();
               	ArrayList roomTypeList = new ArrayList();
               	roomList = guestRoomDao.queryAllRooms();
               	roomTypeList = guestRoomDao.queryAllRoomTypes();
               	int roomid,roomtypeid1,roomtypeid2;
               	String status;
               	String roomname;
               	for(int i = 0;i<roomList.size();i++){
               		status = ((Room)roomList.get(i)).getRoomStatus();
               		if(i%10==0){
               		%>
               		<p><%=i/10+2 %>楼房间</p>
               		<%
               		}
               		for(int j = 0;j<roomTypeList.size();j++){
   		               roomtypeid1 = ((Room)roomList.get(i)).getRoomTypeID();
   		               roomtypeid2 = ((RoomType)roomTypeList.get(j)).getRoomTypeID();
   		               if(roomtypeid1==roomtypeid2&&status.trim().equals("1")){
   		                	roomname = ((RoomType)roomTypeList.get(j)).getRoomTypeName();
   		                	roomid = ((Room)roomList.get(i)).getRoomID();
            		%>
			              	 <div class="roomRec">
			              	 <div><%=roomid%>&nbsp;&nbsp;&nbsp;&nbsp;<%=roomname%></div>
			              	 <div style="margin-top: 15px;font-size: 20px">空</div>
			              	 </div>
			                <%
			                	break;
                   			}else if(roomtypeid1==roomtypeid2&&status.trim().equals("0")){
                   				roomname = ((RoomType)roomTypeList.get(j)).getRoomTypeName();
    		                	roomid = ((Room)roomList.get(i)).getRoomID();
			                %>
		                	 <div class="roomRec" style="background-color:red;">
			              	 <div><%=roomid%>&nbsp;&nbsp;&nbsp;&nbsp;<%=roomname %></div>
			              	 <div style="margin-top: 15px;font-size: 20px">满</div>
			              	 </div>
		                	<%
		                	break;
               			}
             		 }
            	}
             %>           
        </div>
    </div>
     <div id="mask">
            <div class="mask">
                <div class="title">
                    	添加个人信息
                </div>
                <div class="content">
                    <form action="/HotelSystem/Servlets/AddMyInfoServlet" method="post" onSubmit="return beforeSubmit()" id="form">
                        <div>
                            <span>顾 客 姓 名：&nbsp;</span>
                            <input type="text" name="name" value="" placeholder="顾客姓名" id="name">
                        </div>
                        <div>
                            <span>身&nbsp;&nbsp;份&nbsp;&nbsp;证：&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="idcard" value="" placeholder="身份证" id="idcard">
                        </div>
                        <div>
                            <span>年&nbsp;&nbsp;龄&nbsp;&nbsp;：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="age" value="" placeholder="年龄" id="age">
                        </div>
                        <div>
                            <span>电&nbsp;&nbsp;话：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="phone" value="" placeholder="电话" id="phone">
                        </div>
                        <div>
                            <span>性&nbsp;&nbsp;别：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span>
                            <input type="text" name="sex" value="" placeholder="性别" id="sex">
                        </div>
                        <div>
                            <span>是否黑名单：&nbsp;</span>
                            <input type="text" name="blackList" value="否" placeholder="是否黑名单" readonly=”readonly” id="blackList">
                        </div>
                        <input type="hidden" value="" name="lastid" id="lastid">
                        <div>
                            <input value="更新" type="submit" class="amendBtn" style="width: 56px;background:#008cd5;color: #fff;" id="updateBtn">
                        </div>
                    </form>
                </div>
            </div>
        </div>
        <%
			String role = (String)session.getAttribute("role");
			if(role!=null && role!=""){
				if(role.equals("1")){
					String account = (String)session.getAttribute("account");
					ClientDaoImpl clientDao = new ClientDaoImpl();
					String id = clientDao.queryClientId(account);
					if(id==null||id==""){
						%>
						<script type="text/javascript">
							var mask = document.getElementById("mask");
							mask.style.display = "block";
						</script>
						<%
					}
				}
			}
	 	%>
	 <script src="javascripts/realTimeRoom.js"></script>
  </body>
</html>
